package com.dyg.shiro;

import org.apache.shiro.authz.Permission;
import org.apache.shiro.authz.permission.PermissionResolver;
import org.apache.shiro.authz.permission.WildcardPermission;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;



public class UrlPermissionResolver implements PermissionResolver{
	 private static final Logger logger = LoggerFactory.getLogger(UrlPermissionResolver.class);

	@Override
	public Permission resolvePermission(String s) {
		 logger.debug("s => " + s);

	        if(s.startsWith("/")){
	            return new UrlPermission(s);
	        }
	        return new WildcardPermission(s);
	}

}
